<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!Doctype html>
<html>
<head>
    <meta content="text/html" charset="utf-8">
    <title>党建</title>
    <meta name="keywords" content="务川,党建"/>
    <meta name="description" content="务川,党建"/>
    <link href="../../static/images/ico/favicon.png" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="../../static/css/info.css">
    <script type="text/javascript" src="../../static/js/user/jq181.js"></script>
    <script type="text/javascript" src="../../static/js/user/info.js"></script>

    <%--后台--%>
    <link rel="stylesheet" href="../../sys/resources/css/reset.css" type="text/css" media="screen"/>
    <link rel="stylesheet" href="../../sys/resources/css/style.css" type="text/css" media="screen"/>
    <link rel="stylesheet" href="../../sys/resources/css/invalid.css" type="text/css" media="screen"/>
    <link rel="stylesheet" href="../../sys/resources/css/bootstrap.css" type="text/css" media="screen"/>
    <link rel="stylesheet" href="../../sys/resources/css/bootstrap-datetimepicker.min.css" type="text/css" media="screen"/>

    <script type="text/javascript" src="../../sys/resources/scripts/zhTable.js"></script>
    <script type="text/javascript" src="../../sys/resources/scripts/bootstrap.js"></script>
    <script type="text/javascript" src="../../sys/resources/scripts/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="../../sys/resources/scripts/bootstrap-datetimepicker.zh-CN.js"></script>

    <script >
        var moduleName="inform";
        var deleteUrl = "/inform/delete.do";
        function initData(tds,data,index)
        {
            $(tds[0]).html("<input type='checkbox' value='"+data.uid+"'>");
            $(tds[1]).html(data.title);
            $(tds[2]).html(data.starttime);
            $(tds[3]).html(data.endtime);

//            var oper = "<a role='button' class='bottom btn-primary btn-sm' href='/"+moduleName+"/edit.do?id="+data.uid+"'>编辑</a>"
            var oper = "&nbsp;&nbsp;<a role='button' class='bottom btn-primary btn-sm' href='/"+moduleName+"/content.do?id="+data.id+"'>查看</a>"
            $(tds[4]).html(oper);
        }
        var zhTable = null;
        $(function () {
            //初始化table的js，
            //$("#tablePageDiv") 指定操作div ，
            //initData 填充数据的方法
            //true 页面初始化时加载数据
            zhTable = new initZhTable($("#tablePageDiv"), initData,true);


            //初始化时间插件
            $('.form_datetime').datetimepicker({
                format: 'yyyy-mm-dd',
                language: 'zh-CN',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0
            }).click(function () {
                        $(this).val("");
                    });
        });

        function deleteDate() {
            var ids = zhTable.getAllChecked();
            if(ids == null || ids == "")
            {
                alert("请选择数据");
                return;
            }
            if (!window.confirm("危险操作，你确定删除吗？"))   //确定是否删除
                return false;

            var query = new Object();
            query.id = ids;

            //发起请求 提交数据
            $.ajax({
                url: deleteUrl,
                type:"POST",
                cache: false,
                data:{ids:ids},
                dataType:"json",
                success: function(data) {
                    if (data.num == '-1') {
                        alert("删除异常！");
                    }
                    else {
                        alert("成功，删除" + data.num + "个！")
                        $(".searchBtn").click();//重新加载
                    }
                },
                error : function() {
                    alert("请求异常");
                }
            });
        }
    </script>

    <c:if test="${empty sessionScope.sysUser}">
        <script type="text/javascript">
            alert("亲爱的用户，请先登录");
            window.location.href="/loginReg/login.do";
        </script>
    </c:if>
</head>
<body>
<jsp:include page="../../themes/header.jsp"/>
<div id="middle">
    <div class="wrapper">
        <div id="middle-content">
            <div class="article-wrapper">
                <%--<div class="article-content-wrapper">--%>
                <%--<div class="container">--%>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">我的通知</h3>
                    </div>
                    <div class="panel-body">
                        <div id="tablePageDiv">
                            <div id="searchDiv">
                                <form name="searchDivForm" url="/inform/query.do">
                                    <div class="row">
                                        <div class="col-xs-4">
                                            <div class="input-group">
                                                <span class="input-group-addon">标题</span>
                                                <input type="text" name="title" value="" class="form-control">
                                            </div>
                                        </div>

                                    </div>

                                    <div class="row" style="margin-top: 7px;">
                                        <div class="col-xs-1">
                                            <button type="button" class="btn btn-success btn-block searchBtn" style="padding: 6px">查询</button>
                                        </div>
                                    </div>
                                </form>
                            </div>

                            <div id="tableDiv" style="margin-top: 10px;">
                                <table class="table table-hover table-bordered .table-condensed">
                                    <thead>
                                    <tr  class="bg-success">
                                        <th style="width: 60px;"><input class="checkAll" type="checkbox"/>全选</th>
                                        <th>标题</th>
                                        <th>开始时间</th>
                                        <th>截止时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>

                                    </tbody>
                                </table>
                                <ul class="pagination">

                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <%--</div>--%>
            </div>
        </div>
    </div>
</div>
<%--</div>--%>
<jsp:include page="../../themes/footer.jsp"/>

</body>
</html>